"""
!/usr/bin/env python
-*- coding: utf-8 -*-
@Author  : MarkJia
@Site    : 
@File    : conftest.py
"""

import pytest
from selenium import webdriver


# 定义登录的数据共享，自动应用 autouse=True
@pytest.fixture()
def login():
    # setup操作
    print('完成登录操作')
    token = '931585776884645888'
    yield token  # 返回 token
    print('完成登出操作')


# 定义连接浏览器的数据共享
@pytest.fixture()
def get_driver():
    driver = webdriver.Chrome()
    driver.implicitly_wait(10)
    driver.maximize_window()
    yield driver
    driver.quit()


# 定义连接数据库的数据共享
@pytest.fixture()
def connectDB():
    print('连接数据库')
    yield
    print('断开数据库')


# from typing import Optional
#
# def pytest_runtest_setup(item: "Item") -> None:
#     print("hook: setup")
#
#
# def pytest_runtest_teardown(item: "Item", nextitem: Optional["Item"]) -> None:
#     print('hook: teardown')
